//
//  YPMoreViewController.m
//  ChengHuiTong
//
//  Created by KiVen on 15/11/2.
//  Copyright © 2015年 张文权. All rights reserved.
//

#import "YPMoreViewController.h"
#import "YPLogonViewController.h"
#import "CLLockVC.h"
#import "CoreArchive.h"
#import "CoreLockConst.h"
#import "SetPassWordViewController.h"
#import "YPStationMessageViewController.h"

#import "MoreTableViewCell.h"
#import "YPNotificationManagerViewController.h"
#import "YPPasswordManageViewController.h"
#import "YPEmailCertificateViewController.h"

@interface YPMoreViewController ()<UITableViewDataSource,UITableViewDelegate,UIActionSheetDelegate,UINavigationControllerDelegate,UIImagePickerControllerDelegate>{
    
    
    UITableView * _moreTableView;
    NSArray * _sectionBArray;
    NSArray * _sectionCArray;
    //    用户image
    UIImage * _headImage;
    
    NSDictionary*_imageviewDic;
    
    NSDictionary*_titleDic;
    
}

@end



@implementation YPMoreViewController

- (void)dealloc
{
    [[NSNotificationCenter defaultCenter] removeObserver:self];
}

- (void)refreshNofification{
    
    [_moreTableView reloadData];
}

-(instancetype)init{
    
    self=[super init];
    
    if (self) {
        
        _imageviewDic=@{
                        
                        @"0":@[@"gesture",@"mykefu",@"xgsj",@"email"],
                        @"1":@[@"gesture"],
                        @"2":@[@"message",@"address"],
                        @"3":@[@"notification",@"password"],
                        @"4":@[@"safe_guarantee",@"suggestion",@"about"],
                        @"5":@[@""],
                        };
        
        
        _titleDic=@{
                    
                    @"0":@[@"不用填",@"我的客服",@"  修改手机",@" 邮箱认证"],
                    @"1":@[@" 手势密码"],
                    @"2":@[@"站内信",@" 收货地址"],
                    @"3":@[@"通知管理",@"密码管理"],
                    @"4":@[@"安全保障",@"给我们提意见",@"关于我们"],
                    @"5":@[@"退出登录"],
                    };
        
        
        
        [[NSNotificationCenter defaultCenter]addObserver:self
                                                selector:@selector(refreshNofification)
                                                    name:@"YPMoreVCRefreshNofification"
                                                  object:nil];
        
    }
    /**
     *1213131
     */
    
    
    return self;
    
}
- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.navigationItem.title = @"更多";
    self.view.backgroundColor=kColor_AppBaseBackground;
    
    [self creatMoreView];
    
}
- (void)viewWillAppear:(BOOL)animated{
    
    [super viewWillAppear:YES];
    
    [_moreTableView reloadData];
    
    [MobClick beginLogPageView:@"更多"];
    
    [self.navigationController setNavigationBarHidden:NO animated:YES];
    
}
- (void)viewWillDisappear:(BOOL)animated{
    [super viewWillDisappear:YES];
    [MobClick endLogPageView:@"更多"];
}
- (void)creatMoreView{
    
    _moreTableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT-64) style:UITableViewStyleGrouped];
    _moreTableView.dataSource = self;
    _moreTableView.delegate = self;
    _moreTableView.contentInset = UIEdgeInsetsMake(-35, 0, 0, 0);
    _moreTableView.sectionHeaderHeight =15.0f;
    _moreTableView.sectionFooterHeight = 0.0f;
    _moreTableView.backgroundColor = kColor_AppBaseBackground;
    [self.view addSubview:_moreTableView];
    //
    //    NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary];
    //    NSString *app_Version = [NSString stringWithFormat:@"当前版本号:%@",[infoDictionary objectForKey:@"CFBundleShortVersionString"]];
    //    UILabel *footLabel = [UILabel creatWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 40)
    //                                            font:[UIFont systemFontOfSize:14]
    //                                            text:app_Version
    //                                       textColor:[UIColor grayColor]
    //                                   textAlignment:1];
    //    _moreTableView.tableFooterView = footLabel;
    
}

#pragma mark - 系统委托方法(UITableViewDelegate)
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    
    if ([YPShareAccountInfo shareAccountInfo].token == nil) {
        
        return [_titleDic allKeys].count-1;
        
        
    }else{
        
        return [_titleDic allKeys].count;
        
    }
    
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    
    
    NSArray*countArr=_titleDic[[NSString stringWithFormat:@"%ld",(long)section]];
    return countArr.count;
    
    
    
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    if (indexPath.section == 0) {
        
        if (indexPath.row!=0) {
            
            return 44;
        }
        
        return 60;
        
    }else{
        
        return 44;
    }
    
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    
    if (indexPath.section==0) {
        
        if (indexPath.row==0) {
            
            
            
            MoreTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"cell0"];
            
            if (!cell) {
                cell = [[MoreTableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell0"];
                cell.accessoryType = UITableViewCellAccessoryNone;
                
                
            }
            
            
            return cell;
            
        }else{
            
            
            MoreTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"cell3"];
            
            if (!cell) {
                cell = [[MoreTableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell3"];
                cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
                
                cell.textLabel.font=[UIFont boldSystemFontOfSize:15];
                
                cell.textLabel.textColor=UIColorFromString(@"#888888");
                
                
                
            }
            
            cell.textLabel.textAlignment=0;
            cell.textLabel.text=_titleDic[[NSString stringWithFormat:@"%ld",(long)indexPath.section]][indexPath.row];
            
            cell.imageView.image= [UIImage imageNamed:_imageviewDic[[NSString stringWithFormat:@"%ld",(long)indexPath.section]][indexPath.row]] ;
            
            return cell;
            
            
        }
        
    }
    else if (indexPath.section==1){
        
        
        MoreTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"cell1"];
        
        if (!cell) {
            cell = [[MoreTableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell1"];
            cell.accessoryType = UITableViewCellAccessoryNone;
            
            cell.textLabel.font=[UIFont boldSystemFontOfSize:15];
            cell.textLabel.textColor=UIColorFromString(@"#888888");
            
            
        }
        cell.textLabel.textAlignment=0;
        cell.imageView.image= [UIImage imageNamed:_imageviewDic[[NSString stringWithFormat:@"%ld",(long)indexPath.section]][indexPath.row]] ;
        
        cell.textLabel.text=_titleDic[[NSString stringWithFormat:@"%ld",(long)indexPath.section]][indexPath.row];
        
        
        BOOL hasPwd = [CLLockVC hasPwd];
        
        //        NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
        //        [defaults setBool:YES forKey:@"hasPwd"];
        //        [defaults synchronize];
        
        if (hasPwd) {
            
            [ cell.gestureSwith setOn:YES];
            
        }else{
            
            [cell.gestureSwith  setOn:NO];
        }
        
        
        cell.gestureSwith.userInteractionEnabled=[YPShareAccountInfo shareAccountInfo].token?YES:NO;
        
        
        
        cell.swithClickBlock=^(UISwitch*gestureSwith){
            
            
            BOOL isButtonOn = [gestureSwith isOn];
            if (isButtonOn) {
                
                NSLog(@"打开开关");
                BOOL hasPwd = [CLLockVC hasPwd];
                hasPwd = NO;
                if(hasPwd){
                    
                    NSLog(@"已经设置过密码了，你可以验证或者修改密码");
                }else{
                    
                    
                    [CLLockVC showSettingLockVCInVC:self ishome:YES successBlock:^(CLLockVC *lockVC, NSString *pwd) {
                        
                        NSLog(@"密码设置成功");
                        
                        [lockVC dismiss:1.0f];
                        
                    }];
                    
                }
                
                
            }else {
                
                [CLLockVC showVerifyLockVCInVC:self ishome:YES forgetPwdBlock:^{
                    
                } successBlock:^(CLLockVC *lockVC, NSString *pwd) {
                    
                    YPgesturePassword*pwdBin=[[YPgesturePassword alloc] init];
                    
                    pwdBin.token=[YPShareAccountInfo shareAccountInfo].token;
                    
                    pwdBin.g_status=@"0";
                    
                    [YPHttpRequestMethod sendAsyRequestURL:SET_GESTURESPASSWORD withData:[pwdBin dictionaryValue] withCompletionBlock:^(NSDictionary *responseDictionary) {
                        
                        
                        if ([responseDictionary[@"status"] intValue]==0) {
                            
                            [CoreArchive removeStrForKey:CoreLockPWDKey];
                            
                            [gestureSwith  setOn:NO];
                            
                            [lockVC dismiss:0.0f];
                        }
                        
                        
                        
                    } withFailedBlock:^(NSError *error) {
                        
                        [MBProgressHUD showError:@"网络连接失败" toView:self.view];
                        
                        [gestureSwith  setOn:YES];
                        
                        
                    } withIndicator:NO atView:nil];
                    
                    NSLog(@"关闭开关");
                }];
                
                
            }

        };
        
        return cell;
        
    }
    else if(indexPath.section==2){
        
        MoreTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"cell2"];
        
        if (!cell) {
            cell = [[MoreTableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell2"];
            cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
            
            cell.textLabel.font=[UIFont boldSystemFontOfSize:15];
            
            cell.textLabel.textColor=UIColorFromString(@"#888888");
            
        }
        
        if (User.msg_unread_count.integerValue > 0 && indexPath.row == 0) {
            
            NSInteger unReadCount = User.msg_unread_count.integerValue;
            
            cell.unReadLabel.hidden = unReadCount > 0?NO:YES;
            
            if (unReadCount > 99) {
                cell.unReadLabel.text = @"99+";
            }else{
                cell.unReadLabel.text=[NSString stringWithFormat:@"%ld",unReadCount];
            }
            
        }else{
            
            cell.unReadLabel.hidden = YES;
        }
        
        cell.imageView.image= [UIImage imageNamed:_imageviewDic[[NSString stringWithFormat:@"%ld",(long)indexPath.section]][indexPath.row]] ;
        
        cell.textLabel.text=_titleDic[[NSString stringWithFormat:@"%ld",(long)indexPath.section]][indexPath.row];
        return cell;
        
        
    }else{
        
        MoreTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"cell3"];
        
        if (!cell) {
            cell = [[MoreTableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell3"];
            
            cell.textLabel.font=[UIFont boldSystemFontOfSize:15];
            
            cell.textLabel.textColor=UIColorFromString(@"#888888");
            
        }
        
        if (indexPath.section==5 || indexPath.section == 6) {
            cell.accessoryType = 0;
            cell.textLabel.textAlignment=1;
        }else{
            cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
            cell.textLabel.textAlignment=0;
        }
        
        
        cell.imageView.image= [UIImage imageNamed:_imageviewDic[[NSString stringWithFormat:@"%ld",(long)indexPath.section]][indexPath.row]] ;
        cell.textLabel.text=_titleDic[[NSString stringWithFormat:@"%ld",(long)indexPath.section]][indexPath.row];
        
        return cell;
        
    }
    
    
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    
    if (indexPath.section == 0) {
        
        if ([YPShareAccountInfo shareAccountInfo].token == nil) {
            
            YPLogonViewController * logonVC = [[YPLogonViewController alloc]init];
            
            BaseNavigationController * nav = [[BaseNavigationController alloc]initWithRootViewController:logonVC];
            
            [self presentViewController:nav animated:YES completion:^{
                
            }];
            
        }else{
            if (indexPath.row==0) {
                
                UIActionSheet *changePhotoActionSheet =[[UIActionSheet alloc]initWithTitle:nil delegate:self cancelButtonTitle:@"取消" destructiveButtonTitle:nil otherButtonTitles:@"拍照",@"相册",nil];
                changePhotoActionSheet.actionSheetStyle = UIBarStyleDefault;
                [changePhotoActionSheet showInView:self.view];
                
            }else if (indexPath.row==1){ //我的客服
                
                YPGoWebView(String_Connect(CMD_KEFU, @"&token", TOKEN), self.navigationController);
                
            }else if (indexPath.row == 2){ //修改手机
                
                YPGoWebView(String_Connect(CMD_KEFU, @"&token", TOKEN), self.navigationController);
                
            }else{ //邮箱认证
                
                YPEmailCertificateViewController * emailCertificateVC = [[YPEmailCertificateViewController alloc]init];
                
                [self.navigationController pushViewController:emailCertificateVC animated:YES];
                
            }
            
        }
        
        
        
    }if (indexPath.section ==1) {
        
        if ([YPShareAccountInfo shareAccountInfo].token == nil) {
            
            YPLogonViewController * logonVC = [[YPLogonViewController alloc]init];
            
            BaseNavigationController * nav = [[BaseNavigationController alloc]initWithRootViewController:logonVC];
            
            [self presentViewController:nav animated:YES completion:^{
                
            }];
            
        }
    }
    
    
    if (indexPath.section ==2) {
        
        if (indexPath.row == 0) {
            
            if ([YPShareAccountInfo shareAccountInfo].token == nil) {
                
                YPLogonViewController * logonVC = [[YPLogonViewController alloc]init];
                
                BaseNavigationController * nav = [[BaseNavigationController alloc]initWithRootViewController:logonVC];
                
                [self presentViewController:nav animated:YES completion:^{
                    
                }];
                
            }else{
                
                YPStationMessageViewController * stationMessageVC = [[YPStationMessageViewController alloc]init];
                
                [self.navigationController pushViewController:stationMessageVC animated:YES];
                
            }
            
        }else{ //收货地址
            NSString * url = [NSString stringWithFormat:@"%@index.php?m=app&c=user&a=address&token=%@",kAppHostAddress,TOKEN];
            
            if (TOKEN) { //验证token有效性
                
                [self goWebViewWithUrlString:url];
                
            }else{ //没有token
                
                [self goToLoginVCWithCompleteBlock:^(NSString *token){
                    
                    [self goWebViewWithUrlString:url];
                }];
            }
            
        }
        
        
    }
    
    if (indexPath.section == 3) {
        
        
        if ([YPShareAccountInfo shareAccountInfo].token == nil) {
            
            YPLogonViewController * logonVC = [[YPLogonViewController alloc]init];
            
            BaseNavigationController * nav = [[BaseNavigationController alloc]initWithRootViewController:logonVC];
            
            [self presentViewController:nav animated:YES completion:^{
                
            }];
            
        }else{
            
            switch (indexPath.row) {
                case 0:
                {
                    YPNotificationManagerViewController * notificationManagerVC = [[YPNotificationManagerViewController alloc]init];
                    
                    [self.navigationController pushViewController:notificationManagerVC animated:YES];
                    
                    
                }
                    break;
                case 1:
                {
                    
                    YPPasswordManageViewController * passwordManageVC = [[YPPasswordManageViewController alloc]init];
                    [self.navigationController pushViewController:passwordManageVC animated:YES];
                    
                }
                    
                    
                default:
                    break;
            }
            
            
        }
        
        
    }if (indexPath.section == 4) {
        
        
        switch (indexPath.row) {
            case 0:{

                NSString * url = [NSString stringWithFormat:@"%@index.php?m=app&c=app&a=guarantee",kAppHostAddress];
                
                YPWebViewController * webVC = [[YPWebViewController alloc]initWithUrl:url];
                webVC.title = @"安全保障";
                [self.navigationController pushViewController:webVC animated:YES];
            }
                
                break;
            case 1:{
                
                if ([YPShareAccountInfo shareAccountInfo].token == nil) {
                    
                    YPLogonViewController * logonVC = [[YPLogonViewController alloc]init];
                    
                    BaseNavigationController * nav = [[BaseNavigationController alloc]initWithRootViewController:logonVC];
                    
                    [self presentViewController:nav animated:YES completion:^{
                        
                    }];
                    
                }else{
                    
                    
                    NSString * url = [NSString stringWithFormat:@"%@index.php?m=app&c=app&a=feedback&token=%@",kAppHostAddress,[YPShareAccountInfo shareAccountInfo].token];
                    
                    YPWebViewController * webVC = [[YPWebViewController alloc]initWithUrl:url];
                    webVC.title = @"意见反馈";
                    [self.navigationController pushViewController:webVC animated:YES];
                    
                }
                
                
            }
                
                break;
                
            case 2:{
                
                NSString * url = [NSString stringWithFormat:@"%@index.php?m=app&c=app&a=about",kAppHostAddress];
                YPWebViewController * webVC = [[YPWebViewController alloc]initWithUrl:url];
                webVC.title = @"关于我们";
                [self.navigationController pushViewController:webVC animated:YES];
                
            }
                
                break;
                
                
            default:
                break;
        }
        
        
    }
    
    
    
    
    if (indexPath.section ==5) {
        
        
        UIAlertView * deleteAlertView = [[UIAlertView alloc]initWithTitle:nil message:@"你确定退出登录？" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确定", nil];
        [deleteAlertView show];
        
    }
    
    
    
    
}

- (void)goWebViewWithUrlString:(NSString *)urlString{
    
    YPGoWebView(urlString, self.navigationController);
}

- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
    
    if (buttonIndex == 1) {
        
        
        YPLoginOutBin * bin = [[YPLoginOutBin alloc]init];
        bin.token = [YPShareAccountInfo shareAccountInfo].token;
        
        [RequestModel LogOutSuccessBlock:^(id obj) {
            
            [CoreArchive removeStrForKey:CoreLockPWDKey];
            
            YPShareAccountInfo * shareAccount = [YPShareAccountInfo shareAccountInfo];
            [shareAccount clearData];
            
            [self.navigationController popToRootViewControllerAnimated:NO];
            YPLogonViewController * logonVC = [[YPLogonViewController alloc]init];
            BaseNavigationController * nav = [[BaseNavigationController alloc]initWithRootViewController:logonVC];
            [APPDelegate.window.rootViewController presentViewController:nav animated:YES completion:nil];
            
            
        } failBlock:^(id obj) {
            
            
            [MBProgressHUD showError:@"网络连接失败" toView:self.view];
            
        }];
        
        
    }
    
    
}

-(void)viewDidLayoutSubviews
{
    
    [super viewDidLayoutSubviews];
    
    if ([_moreTableView respondsToSelector:@selector(setSeparatorInset:)]) {
        
        [_moreTableView setSeparatorInset:UIEdgeInsetsMake(0,0,0,0)];
    }
    
    if ([_moreTableView respondsToSelector:@selector(setLayoutMargins:)]) {
        
        [_moreTableView setLayoutMargins:UIEdgeInsetsMake(0,0,0,0)];
    }
}

-(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
    
    if ([cell respondsToSelector:@selector(setSeparatorInset:)]) {
        
        [cell setSeparatorInset:UIEdgeInsetsZero];
    }
    
    if ([cell respondsToSelector:@selector(setLayoutMargins:)]) {
        
        [cell setLayoutMargins:UIEdgeInsetsZero];
    }
    
}

#pragma mark-UIActionSheetDelegate
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
{
    if (buttonIndex == 0 || buttonIndex == 1) {
        UIImagePickerController *picker = [[UIImagePickerController alloc] init];
        if (buttonIndex == 0) {
            picker.sourceType = UIImagePickerControllerSourceTypeCamera;
        }
        else {
            picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
            picker.mediaTypes = [UIImagePickerController availableMediaTypesForSourceType:picker.sourceType];
            
            
            
        }
        picker.delegate = self;
        picker.allowsEditing = YES;//设置可编辑
        
        [picker.navigationBar setBackgroundImage:[LGToolMethods createImageWithColor:kColor_AppNavColor] forBarMetrics:UIBarMetricsDefault];
        picker.navigationBar.tintColor = [UIColor whiteColor];
        //        picker.navigationBar.tintColor = kColor_AppNavColor;
        //        picker.navigationBar.barTintColor = kColor_AppNavColor;
        
        [self.navigationController presentViewController:picker animated:YES completion:nil];
    }
    
    
}
- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker
{
    NSLog(@"取消图片选择");
    
    [picker dismissViewControllerAnimated:YES completion:^{
        
    }];
    
}
//相机代理
-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info{
    
    
    NSLog(@"相机");
    
    
    [picker dismissViewControllerAnimated:YES completion:^{
        
        _headImage =[info objectForKey:UIImagePickerControllerEditedImage];
        
        //把图片压缩
        CGSize imagesize = _headImage.size;
        
        imagesize.width =300;
        
        imagesize.height =300;
        
        UIImage *imageNew = [LGToolMethods imageWithImage:_headImage scaledToSize:imagesize];
        
        NSData *imageData=UIImageJPEGRepresentation(imageNew,1.0);
        
        _headImage=[UIImage imageWithData:imageData];
        
        YPUploadPictureBin * bin = [[YPUploadPictureBin alloc]init];
        
        bin.token = [YPShareAccountInfo shareAccountInfo].token;
        
        [YPHttpRequestMethod uploadImage:_headImage parameters:[bin dictionaryValue] url:CMD_UPLOAD_PICTURE success:^(NSDictionary *responseDictionary) {
            
            NSLog(@"responseDictionary%@",responseDictionary);
            
            if ([responseDictionary[@"status"]intValue]==0) {
                
                NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:0];
                
                MoreTableViewCell * cell1 = [_moreTableView cellForRowAtIndexPath:indexPath];
                
                [cell1.headerImageView sd_setImageWithURL:[NSURL URLWithString:responseDictionary[@"avatar"]] placeholderImage:[UIImage imageNamed:@"driverHeader_placeholder"]];
                
                [YPShareAccountInfo shareAccountInfo].avatar = responseDictionary[@"avatar"];
                
                [[YPShareAccountInfo shareAccountInfo] saveData];
                
                [_moreTableView reloadRowsAtIndexPaths:@[[NSIndexPath indexPathForRow:0 inSection:0]] withRowAnimation:UITableViewRowAnimationNone];
            }
            
            
        } failure:^(NSError *error) {
            
            
        } uploadProgressBlock:^(NSInteger bytesWritten, long long totalBytesWritten, long long totalBytesExpectedToWrite) {
            
        }atView:self.view];
        
    }];
    
}

#pragma mark - 自定义委托方法(CustomDelegate)
#pragma mark - 事件响应
- (void)reload{
    
    [_moreTableView reloadData];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
